package com.zklh.leetcode.tree.easy.problem226;

import com.zklh.leetcode.tree.model.TreeNode;

/**
 * 反转二叉树算法实现
 *
 * @author 坐看落花
 * @version 1.0
 * @date 2021/1/10 17:59
 */
public class Solution {
    public TreeNode invertTree(TreeNode root) {
        if (root == null) {
            return null;
        }
        TreeNode tempNode = root.right;
        root.right = invertTree(root.left);
        root.left = invertTree(tempNode);
        return root;
    }
}
